<template>
  <div>
    <router-view />
    <van-tabbar
      v-model="active"
      active-color="#121212"
      inactive-color="#666"
      route
    >
      <van-tabbar-item
        v-for="(item, index) in tabbarData"
        :key="index"
        :to="item.path"
        replace
      >
        <span>{{ item.text }}</span>
        <template #icon="props">
          <img :src="props.active ? item.active : item.inactive" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
export default {};
</script>
<script>
export default {
  data() {
    return {
      active: 0,
      tabbarData: [
        {
          path: "/home",
          text: "首页",
          active: require("../assets/image/tab_home_yes.png"),
          inactive: require("../assets/image/tab_home_no.png"),
        },
        {
          path: "/shares",
          text: "分享",
          active: require("../assets/image/tab_share_yes.png"),
          inactive: require("../assets/image/tab_share_no.png"),
        },
        {
          path: "/mine",
          text: "我的",
          active: require("../assets/image/tab_mine_yes.png"),
          inactive: require("../assets/image/tab_mine_no.png"),
        },
      ],
    };
  },
  methods: {
    onChange(index) {
      console.log(index);
    },
  },
};
</script>
